package xyz.jcat.seata.example.storage.service;

import io.seata.rm.tcc.api.BusinessActionContext;
import io.seata.rm.tcc.api.BusinessActionContextParameter;
import io.seata.rm.tcc.api.LocalTCC;
import io.seata.rm.tcc.api.TwoPhaseBusinessAction;
import xyz.jcat.seata.example.api.dto.StorageDecrDto;
import xyz.jcat.seata.example.storage.domain.po.ItemStoragePo;
import xyz.jcat.mybatis.IService;

/**
 *
 * @author yueyue
 * auto on 2022-03-16 01:17:30
 */
@LocalTCC
public interface IItemStorageService extends IService<ItemStoragePo> {

    @TwoPhaseBusinessAction(name = "decrItemStorage",
            commitMethod = "decrItemStorageCommitMethod",
            rollbackMethod = "decrItemStorageRollbackMethod"
    )
    void decr(@BusinessActionContextParameter(paramName = "storageDecrDto") StorageDecrDto storageDecrDto);

    boolean decrItemStorageCommitMethod(BusinessActionContext context);

    boolean decrItemStorageRollbackMethod(BusinessActionContext context);
}
